package com.saoft.fangcms.modules.sys.mapper;

import com.saoft.fangcms.modules.sys.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author scc95599
 * @since 2019-12-24
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select sr.* from sys_role sr LEFT JOIN sys_user_role sur ON sr.id = sur.role_id where sur.user_id=#{userId}")
    List<Role> getRolesByUserId(@Param("userId") Long userId);
}
